import React, { Component, Fragment } from 'react';
import { connect } from '../../sagas';

export default connect(({ value }) => {
  return { value };
})(class Container extends Component {

  handleIncrement = (e) => {
    if (e) e.stopPropagation();
    this.props.dispatch({ type: 'increment', payload: {} });
  }

  handleDecrement = (e) => {
    if (e) e.stopPropagation();
    this.props.dispatch({ type: 'decrement', payload: {} });
  }

  render () {
    const props = this.props
    console.log(props);
    return (
      <Fragment>
        <h3>value</h3>
        <div>{this.props.value}</div>
        <button onClick={this.handleIncrement}>+</button>
        <button onClick={this.handleDecrement}>-</button>
      </Fragment>
    );
  }
});
